import { request } from "./request";


export function updatauser() {
  return request({
    url: '/login/refresh'
  })
}


//登录
export function getlogin(phone, password) {
  return request({
    url: '/login/cellphone',
    params: {
      phone:phone,
      password:password
    }
  }) 
}

//二维码key生成
export function getqrkey(timestamp) {
  return request({
    url: '/login/qr/key',
    params: {
      timestamp
    }
  })
}

//获取二维码接口
export function getcreateqr(key, timestamp) {
  return request({
    url: '/login/qr/create',
    params: {
      key,
      timestamp
    }
  })
}

export function getqrcheck(key, timestamp) {
  return request({
    url: '/login/qr/check',
    timeout:10000,
    params: {
      key,
      timestamp,
    }
  })
}



//登录账号信息
export function getUserInfo() {
  return request({
    url: '/user/account'
  }) 
}

//每日推荐歌单
export function getResource() {
  return request({
    url: '/recommend/resource'
  }) 
}


//获取用户歌单
export function getUserPlayList(uid) {
  return request({
    url: '/user/playlist',
    params: {
      uid:uid
    }
  }) 
}

//获取喜欢音乐列表
export function getlikelist(uid) {
  return request({
    url: '/likelist',
    params: {
      uid
    }
  })
}

//取反喜欢
export function getlikestate(id,like) {
  return request({
    url: '/like',
    params: {
      id,
      like
    }
  })
}


//退出登录
export function userlogout() {
  request({
    url: '/logout',
  })
}

//云盘音乐
export function usercloud() {
  request({
    url: '/user/cloud',
  })
}


/* export class UserInfo {
  constructor(userinfo) {  
    //用户名字
    this.nickname = userinfo.data.profile.nickname
    //用户头像
    this.avatarUrl = userinfo.data.profile.avatarUrl
  } 
} */